/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.uca.sisbec.helpers.reportes;

import com.uca.sisbec.beans.ReporteMateriasXBecarioBean;
import com.uca.sisbec.mapping.Becario;
import java.util.ArrayList;
import org.hibernate.Query;
import org.hibernate.Session;

/**
 *
 * @author Susy
 */
public class ReporteNotasCarreraHelper {
    
     private Session session;

    public ReporteNotasCarreraHelper(Session session) {
        this.session = session;
    }
    public ArrayList<ReporteMateriasXBecarioBean> construirReporteNotas(int codCarrera,Becario bec){
        String hql="select new com.uca.sisbec.beans.ReporteMateriasXBecarioBean(m.nombre, mxb.notaFinal,mxb.annio,mxb.matricula) From Materia as m, "
                + "MateriaXCarrera as mxc,"
                + "MateriaXBecario as mxb where "
                + "mxc.id.codMateria=mxb.id.codMateria and "
                + "mxc.id.codCarrera = :cod"
                + " and m.codMateria=mxb.id.codMateria and "
                + "mxb.id.carnet= :carnet";
       Query query = session.createQuery(hql);
       query.setInteger("cod", codCarrera);
       query.setString("carnet",bec.getCarnet());
       return new ArrayList<ReporteMateriasXBecarioBean>(query.list());
    }
}
